<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>头部</title>
		<link rel="stylesheet" href="../css/style.css" />
	</head>

	<body>
		<!--头部-->
		<div class="header">
			<div class="logo">
				<img class="img " src="../images/index/u12.png">
			</div>
			<div id="navigation" class="navigation">
				<ul>
					<li tip="index.html" class="active">首页 </li>
					<li tip="productintro.html">产品介绍</li>
					<li tip="dataservice.html">数据应用</li>
					<li tip="manage.html">账户管理</li>
					<li tip="aboutus.html"> 关于我们</li>
				</ul>
			</div>
			<div class="login"><a id="login_a" href="javascript:void(0);">登录</a></div>
		</div>
	</body>
	<script src="../js/jquery-2.1.4.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function() {
			//登录前的header
			var navigation = $("#navigation>ul>li");
			var login_a = $("#login_a");
			//点击header导航栏
			navigation.on("click", function() {
				var tip = $(this).attr('tip');
				if (window.top.location.href.indexOf(tip) > -1) {
					return;
				}
				var loginUser = getLocalStorage(STORATE_MANAGER.user);
				var redirectUrl = (("manage.html" == tip) ? ((null == loginUser) ? tip : "managelogined.html") : tip);
				window.top.location.href = ("../" + redirectUrl);
			});
			$(login_a).on("click", function() {
				if ('退出' == $(this).html()) {
					removeLocalStorage(STORATE_MANAGER.user);
				}
				window.top.location.href = ("../" + "manage.html");
			});
			//导航栏颜色
			var i = 0;
			while (navigation[i]) {
				if (window.top.location.href.indexOf($(navigation[i]).attr('tip')) > -1) {
					$(navigation[i]).addClass('active').siblings().removeClass('active');
					break;
				}
				i++;
			}
			var loginUser = getLocalStorage(STORATE_MANAGER.user);
			if (loginUser) {
				login_a.html("退出");
			}
		});
	</script>

</html>